

$(function () {
    var is = document.getElementsByClassName("banner-list");
    var banner_num = document.getElementsByClassName("curr");
    var conut = 0;
    var  timer = setInterval(run, 5000);
    function run() {
        conut++;
        conut = conut == 4 ? 0 : conut;
        for (var i = 0; i < is.length; i++) {
            is[i].style.display = 'none';
            banner_num[i].style.background = '#ffffff';
            banner_num[i].style.color = '#666666';
        }
        var bannerBackground = document.getElementById("bannerBackgroundShow_" + conut);
        var img = document.getElementById('image_' + conut);
        RGBaster.colors(img, {
                success: function (payload) {
                    bannerBackground.style.backgroundColor = payload.dominant;
                }
            }
        );
        is[conut].style.display = 'block';
        banner_num[conut].style.background = '#ff6655';
        banner_num[conut].style.color = '#ffffff';
    }
    $("#banner-body-body").hover(function () {
        console.log('dsadsad');
        clearInterval(timer);
    },function () {
        timer =setInterval(run, 5000);
    });
    $(".banner_num span").mouseenter(function () {
        conut = $(this).index()-1;
    });
});

$(function () {
    var countIndex = 0;
    var imageCount = $('.dog_slide_cont a').length;
    var autoCarousel  = setInterval(figureIndex,2000);
    function figureIndex() {
        if (countIndex < imageCount - 1) {
            countIndex++;
        } else {
            countIndex = 0;
        }
        //调用切换
        changeTo(countIndex);
    }
    //切换图片
    function changeTo(num) {
        //切换图片，也就是把figureList类（ul）向左移动。
        var leftGo = num * 360;
        $(".dog_slide_cont").animate({"left": "-" + leftGo + "px"}, 500);
    }
})


$(function () {
    setInterval(playRun,1000);
    function playRun() {
        console.log("123456");
        $('#dog_slide_cont').css('left',left.defaultValue+400)
    }
});




$(function () {
    var aclass = new Array();
    $('.right-fixed').children('a').each(function () {
        aclass.push($(this).attr('class'));
    });
    for (var i = 0; i < aclass.length - 1; i++) {
        console.log(aclass[i]);
        $("." + aclass[i]).click(function () {
            if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
                var $target = $(this.hash);
                $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']');
                if ($target.length) {
                    var targetOffset = $target.offset().top;
                    $('html,body').animate({scrollTop: targetOffset}, 800);
                    return false;
                }
            }
        });
    }
});
$(function () {
    $(window).scroll(function () {
        if ($(window).scrollTop() > 100) {
            $('.goTop').css('display', 'block');    //<div id-'top'></div>假如有这么个div是那个向上图标的div。css默认none
        }
        else {
            $('.goTop').css('display', 'none');
        }
    });
    $(".goTop").click(function () {
        $('body,html').animate({scrollTop: 0}, 1000);
    });
});
$(function () {
    $('#search').bind({
        focus: function () {
            if (this.value == this.defaultValue) {
                this.value = "";
            }
        },
        blur: function () {
            if (this.value == "") {
                this.value = this.defaultValue;
            }
        }
    })
});
// $(function () {
//     $('.left_btn').click(function () {
//         var body = $('.pet-web-content-bottom-left-c-slide-body');
//         $('.pet-web-content-bottom-left-c-slide-body').animate({body.css('left', '-1485px-495px')
//     },
//         2000
//     )
//         ;
//     })
//     $('.left_btn').click(function () {
//
//     })
//
//
// }